package cn.howxu.yichen_ovo.common.item.cd;

import cn.howxu.yichen_ovo.init.ModSounds;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.RecordItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * @description: TODO
 * @author: HowXu
 * @date: 2025/9/29 17:37
 */
public class Sweet extends RecordItem {

    public Sweet() {
        super(1660, ModSounds.SWEET, (new RecordItem.Properties()).stacksTo(1).rarity(Rarity.RARE), 4780);

    }

    @Override
    public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltip, TooltipFlag pFlag) {
        super.appendHoverText(pStack, pLevel, pTooltip, pFlag);
        pTooltip.stream().forEach(tip -> {
            if (tip.getContents().toString().contains("desc")) {
                int index = pTooltip.indexOf(tip);
                pTooltip.set(index,Component.translatable(tip.getString()).withStyle(ChatFormatting.RED));
            }
        });
        pTooltip.add(Component.translatable("tip.yichen_ovo.keainie").withStyle(ChatFormatting.LIGHT_PURPLE));
    }
}
